package org.skywalker.postbank

class UserController {

	def scaffold = true

	def login = {
		if (!params.name) return
		
		def user = User.findByNameAndPassword(params.name, params.password)
		if (user){
			session.user = user
			redirect(action: "show${user.role}Portal")
		}
		flash.message = "${message(code: 'user.login.failed')}"
		return
	}
	
	def showAdminPortal = {}
	def showBossPortal = {}
	def showOperatorPortal = {
		redirect(controller:"metaData", action:"list")	
	}
}
